#ifndef POINT_H_
#define POINT_H_

#include <cmath>
#include <string>
#include <exception>

const float PI =  3.14159265358979323846f;

class PointException: public std::exception{
	private:
		std::string message;

		virtual const char* what()const throw(){
			return message.c_str();
		}
	public:
		PointException(const std::string& error) : message(error){}
		virtual ~PointException()throw(){}
};

struct Point{
	float x1;
	float x2;
	float x3;
	float x4;

	Point();
	Point(float x1,float x2,float x3=0.0f);

	bool operator ==(const Point& p2)const;
	Point operator-(const Point& p2)const;
	Point operator+(const Point& p2)const;
	Point& operator+=(const Point& p2);
	Point& operator-=(const Point& p2);
	Point& operator*=(const float k);
	Point operator*(const float k)const;
	float operator*(const Point p2)const;

	Point cross(const Point& point)const;
	float mod()const;

	float operator [](int num)const;
	float& operator [](int num);
};

#endif /* POINT_H_ */
